package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.FileUploadService;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.lang.management.MemoryUsage;

@RestController
@RequestMapping("/admin/system")
public class FileUploadController {
    @Autowired
    private FileUploadService fileUploadService;
    @PostMapping(value = "/fileUpload")
    public Result<String> fileUpload(MultipartFile file) {
     String url = fileUploadService.upload(file);
     return Result.build(url, ResultCodeEnum.SUCCESS);
    }


}
